package com.suplet.encryption.controller;

import com.suplet.common.Result;
import com.suplet.encryption.entity.User;
import org.springframework.web.bind.annotation.*;

@RestController
@CrossOrigin
@RequestMapping("/user")
public class UserController {
    @PostMapping("login")
    public Result login(){
        System.out.println("123123");
        return Result.ok().data("token","admin");
    }
    /**
     * 获取用户信息
     *
     * @return roles、name、avatar(头像）
     *
     */
    @GetMapping("info")
    public Result info(){
        return Result.ok().data("roles","admin").data("name","admin").data("avatar","https://wpimg.wallstcn.com/f778738c-e4f8-4870-b634-56703b4acafe.gif");
    }
    @GetMapping("get")
    public Result test1(@RequestParam Integer id, @RequestParam String username){
        System.out.println(id);
        System.out.println(username);
        return Result.ok();
    }
    @PostMapping("post")
    public Result test2(@RequestBody User user){
        System.out.println(user);
        return Result.ok();
    }
    @DeleteMapping("delete")
    public Result test3(@RequestBody User user){
        System.out.println(user);
        return Result.ok();
    }
    @PutMapping("put")
    public Result test4(@RequestBody User user){
        System.out.println(user);
        return Result.ok();
    }
    @PatchMapping("patch")
    public Result test5(@RequestBody User user){
        System.out.println(user);
        return Result.ok();
    }
}
